import { brandPageSelect } from '@/api/goodsInfo'
import { ref } from 'vue'

export default () => {
  const brandOptions = ref<Array<GoodBrandOptions>>([])
  const getBrandOptionsLoading = ref(false)
  const getBrandOptionsParam = ref({
    limit: 0,
    page: 0,
    name: '',
  })

  const getBrandOptions = async () => {
    getBrandOptionsLoading.value = true
    const res = await brandPageSelect(getBrandOptionsParam.value)
    getBrandOptionsLoading.value = false
    brandOptions.value = res.data.data.rows
  }

  return {
    brandOptions,
    getBrandOptionsParam,
    getBrandOptionsLoading,
    getBrandOptions,
  }
}
